package com.buaa.wangrui.client.panel;

import com.buaa.wangrui.client.theme.ThemeChanger;
import com.google.gwt.user.client.ui.RootPanel;
import com.gwtext.client.core.RegionPosition;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.Viewport;
import com.gwtext.client.widgets.Window;
import com.gwtext.client.widgets.form.Label;
import com.gwtext.client.widgets.layout.AccordionLayout;
import com.gwtext.client.widgets.layout.BorderLayout;
import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.FitLayout;

public class MainPanel extends Panel{
	
	public Panel borderPanel;
	public String bodyStyle = "text-align:center;padding:0 0;"
//        + "border:1px dotted #99bbe8;background:#dfe8f6;"
        + "color:#15428b;"
        + "font:bold 48px tahoma,arial,sans-serif;"
        ;
	public  Label welcLabel ;
	

	
	public MainPanel(){
	
		
		this.setBodyBorder(false);
		this.setPaddings(10);
		this.setLayout(new FitLayout());
		this.setSize(1420, 752);
		this.doLayout();
		borderPanel = new Panel();
		borderPanel.setLayout(new BorderLayout());
		
		createNorthPanel();
		createSouthPanel();
		createWestPanel();
		createEastPanel();
		createCenterPanel();
		
		this.add(borderPanel);
//		Viewport p = new Viewport(this);
		
	}
	
	private void createNorthPanel(){
		
		welcLabel= new Label("Login Sucessful!");
		welcLabel.setStyle(bodyStyle);
		welcLabel.setId("welcome");
			
		Panel northPanel = new Panel();
        northPanel.setHeight(100);
        northPanel.setWidth(750);
        northPanel.setId("northPanel");
        northPanel.setStyleName("");
        northPanel.setBodyBorder(false);
        northPanel.add(welcLabel);
//        northPanel.setHtml("<P align=center>我的GWT程序</p>\n");
        northPanel.setStyle(bodyStyle);
        borderPanel.add(northPanel, new BorderLayoutData(RegionPosition.NORTH));

	}
	
	private void createSouthPanel(){
		
		Panel southPanel = new Panel();
		southPanel.setHeight(100);
		southPanel.setWidth(750);
		southPanel.setId("southPanel");
		southPanel.setStyleName("");
		southPanel.setBodyBorder(false);
        borderPanel.add(southPanel, new BorderLayoutData(RegionPosition.SOUTH));

	}
	private void createWestPanel(){
		
		final AccordionLayout accordion = new AccordionLayout(true);
		Panel westPanel = new Panel();
		westPanel.setWidth(200);
		westPanel.setId("westPanel");
		westPanel.setStyleName("");
		westPanel.setBodyBorder(false);
		westPanel.setLayout(accordion);
		
	    Panel navPanel1 = new Panel();
	    
        navPanel1.setTitle("文件管理");
        navPanel1.setBorder(false);
        navPanel1.setIconCls("navPanel1-icon");
        navPanel1.setId("navPanel1");
        navPanel1.setMaskDisabled(true);
        navPanel1.isMaskDisabled();
        westPanel.add(navPanel1);

        Panel navPanel2 = new Panel();

        navPanel2.setTitle("用户管理");
        navPanel2.setBorder(false);
        navPanel2.setIconCls("navPanel2-icon");
        westPanel.add(navPanel2);

        Panel navPanel3 = new Panel();

        navPanel3.setTitle("数据管理");
        navPanel3.setBorder(false);
        navPanel3.setIconCls("navPanel3-icon");       
        westPanel.add(navPanel3);


        borderPanel.add(westPanel, new BorderLayoutData(RegionPosition.WEST));

	}
	private void createEastPanel(){
		
		Panel eastPanel = new Panel();
		eastPanel.setWidth(5);
		eastPanel.setBodyBorder(false);
        borderPanel.add(eastPanel, new BorderLayoutData(RegionPosition.EAST));

	}
	
	private void createCenterPanel(){
		
		TabPanel centerPanel = new TabPanel();

		centerPanel.setId("centerPanel");
		centerPanel.setBodyBorder(false);
		centerPanel.setStyleName("");
		centerPanel.setActiveTab(0);
        centerPanel.setEnableTabScroll(true);
        centerPanel.setDeferredRender(false);
        centerPanel.setAutoShow(true);
        centerPanel.setLayoutOnTabChange(true);
        
        final Panel centerPanel_1 = new Panel();
        centerPanel_1.setLayout(new FitLayout());
        centerPanel_1.setTitle("centerPanel_1");
        centerPanel_1.setIconCls("");
        
        

        
        Window win = new Window();
        win.setTitle("jessiena");
        centerPanel_1.add(win);
        win.show();
        
        
        final Panel centerPanel_2 = new Panel();
        centerPanel_2.setLayout(new FitLayout());
        centerPanel_2.setTitle("centerPanel_2");
        centerPanel_2.setIconCls("");
        
        centerPanel.add(centerPanel_1);
        centerPanel.add(centerPanel_2);

        borderPanel.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER));
 
	}

}
